import java.awt.Color;
import java.awt.event.*;
import javax.swing.*;

public class Main extends JFrame implements MouseMotionListener, WindowListener{
	private int cont = 0;
	private JButton boton;
	public Main() {
		this.setLayout(null);
		this.addWindowListener(this);		
		this.getContentPane().setBackground(Color.BLACK);
		boton = new JButton("No pongas aqui el raton");
		boton.setBounds(80, 25, 200, 25);
		this.add(boton);
		boton.addMouseMotionListener(this);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m1 = new Main();
		m1.setBounds(400, 400, 400, 300);
		m1.setVisible(true);		
	}

	@Override
	public void windowActivated(WindowEvent e) {		
		if (cont != 0) {
			System.out.println("Maximizando");
		}
		cont++;
	}

	@Override
	public void windowClosed(WindowEvent e) {			
	}

	@Override
	public void windowClosing(WindowEvent e) {
		System.out.println("Cerrando ventana");
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		System.out.println("Minimizando");
	}

	@Override
	public void windowDeiconified(WindowEvent e) {
	}

	@Override
	public void windowIconified(WindowEvent e) {
	}

	@Override
	public void windowOpened(WindowEvent e) {
	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
	}

	@Override
	public void mouseMoved(MouseEvent arg0) {		
		System.out.println("Estamos dentro del raton");		
	}	
}
